using System.Data;
using System.Collections.Generic;

namespace Net.SamuelChen.Libs.Data.Database {
    /// <summary>
    /// The IQuery Interface provides interface to be used by application to execute sql query on database.
    /// </summary>
    /// <remarks>
    /// <author>Samuel Chen</author>
    /// </remarks>
    public interface IQuery {

        void Dispose();

        bool ExecSql(string sql);
        bool ExecSql(string sql, out IDataReader reader);
        bool ExecSql(string sql, DataSet ds);

        bool ExecStoredProcedure(string sp, IList<IDataParameter> parms);
        bool ExecStoredProcedure(string sp, IList<IDataParameter> parms, IDataReader reader);
        bool ExecStoredProcedure(string sp, IList<IDataParameter> parms, DataSet ds);

        bool ExecCommand(IDbCommand command);
        bool ExecCommand(IDbCommand command, out IDataReader reader);
        bool ExecCommand(IDbCommand command, DataSet ds);

        object ExecScalar(string sql);
        object ExecScalar(string sp, IList<IDataParameter> parms);
        object ExecScalar(IDbCommand command);

        IDbCommand CreateCommand();
        IDataParameter CreateParameter(string parameterName, object value);
        IDataParameter CreateParameter(string parameterName, object value, ParameterDirection direction);
    }
}
